package com.nosnow.gmall.usermanage.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.nosnow.gmall.bean.UserInfo;
import com.nosnow.gmall.usermanage.mapper.UserInfoMapper;
import com.nosnow.gmall.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @类名称：UserServiceImpl
 * @类描述：用户信息ServiceImpl
 * @author: bingHeng
 * @Date
 * @Version: 1.0
*/
@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Autowired
    private UserInfoMapper userInfoMapper;

    @Override
    public List<UserInfo> getUserInfoListAll() {

        // 模糊查询所有名字中带有 易 字的，且id为2的, like查询和多条件拼接查询
        Example example = new Example(UserInfo.class);
        example.createCriteria().andLike("userName", "%易%").andEqualTo("userId", 2);
        return userInfoMapper.selectByExample(example);
    }
}
